//
//  OSL_BottomPopup_ExampleVC.swift
//  APSwift
//
//  Created by jianbo.pei on 2023/9/20.
//

import UIKit
import BottomPopup

class OSL_BottomPopup_ExampleVC: BottomPopupViewController {

    var height: CGFloat?
    var topCornerRadius: CGFloat?
    var presentDuration: Double?
    var dismissDuration: Double?
    var shouldDismissInteractivelty: Bool?
    
    // MARK: - BottomPopupAttributesDelegate Variables
    override var popupHeight: CGFloat { height ?? 300.0 }
    override var popupTopCornerRadius: CGFloat { topCornerRadius ?? 10.0 }
    override var popupPresentDuration: Double { presentDuration ?? 1.0 }
    override var popupDismissDuration: Double { dismissDuration ?? 1.0 }
    override var popupShouldDismissInteractivelty: Bool { shouldDismissInteractivelty ?? true }
    override var popupDimmingViewAlpha: CGFloat { 0.5 }

    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = .yellow
        
        _ = UIButton(type: .custom).then({ make in
            view.addSubview(make)
            make.setTitle("dismiss", for: .normal)
            make.backgroundColor = .blue
            make.snp.makeConstraints { make in
                make.left.equalTo(50)
                make.top.equalTo(180)
                make.size.equalTo(CGSize(width: 200, height: 40))
            }
            make.addTarget(self, action: #selector(dismissAction), for: .touchUpInside)
        })
        
    }
    
    @objc private func dismissAction() {
        dismiss(animated: true, completion: nil)
    }
}


